<template>
	<view class="forgetpassword">
		<view class="forgetpassword-input">
			<input type="text" v-model="phonelogin" placeholder="输入手机号" />
		</view>
		<view class="forgetpassword-input">
			<input type="text" v-model="passwordlogin" placeholder="输入验证码" />
			<view @click="verification">
				<text>获取验证码</text>
			</view>
		</view>
		<view class="forgetpassword-input">
			<input type="text" v-model="newpasswordlogin" placeholder="输入新密码" />
		</view>
		<view class="forgetpassword-input">
			<input type="text" v-model="repetition" placeholder="重复新密码" />
		</view>
		<view class="save" @click="save">
			<text>保存修改</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phonelogin: '', //输入手机号
				passwordlogin: '', //输入验证码
				newpasswordlogin: '', //输入新密码
				repetition: '', //重复新密码
			}
		},
		onLoad() {

		},
		//创建
		created() {

		},
		//挂载
		mounted() {
			this.save()
		},
		//更新
		updated() {

		},
		//销毁
		destroyed() {

		},
		methods: {
			// 保存修改密码
			save() {
				let preserve = {
					mobile: '17633638158', // 手机号
					newpassword: '123456789', //新密码
					rep_password: '123456789', //确认密码
					captcha: '123654', //验证码
				}
				this.$post(this.api.resetpwd, preserve).then((res) => {
					console.log(res)
				}).catch((err) => {
					console.log(err)
				})
			},
			// 验证码
			verification() {
				let security = {
					type: '1',
					mobile: '17633638159', //手机号
					ip: 'bded1c789e396afe', //标识
					imei: 'bded1c789e396afe',
					device: '12346', //设备信息
				}
				this.$post(this.api.verification, security).then((res) => {
					console.log(res);
				}).catch((err) => {
					console.log(err)
				});
			},
		}
	}
</script>

<style lang="less" scoped>
	.forgetpassword {
		width: 650rpx;
		margin: 0 auto;
		padding-top: 30rpx;

		.forgetpassword-input {
			border-bottom: 1rpx solid #E0E0E0;
			height: 60rpx;
			padding-top: 30rpx;
			display: flex;

			input {
				width: 500rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #999999;
			}

			text {
				font-size: 27rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #20A4FB
			}
		}

		.save {
			width: 569rpx;
			height: 80rpx;
			background: linear-gradient(90deg, #2EA7E0 0%, #0099FF 100%);
			border-radius: 13rpx;
			line-height: 80rpx;
			text-align: center;
			margin: 0 auto;
			margin-top: 120rpx;

			text {
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #FFFFFF;
			}
		}
	}
</style>
